<table style="width: 100%" class="table-show">
	<thead>
	  <tr>
	    <th colspan="2"><?php echo __("Curso");?></th>
	    <th><?php echo __("Tipo de Pago");?></th>
	    <th><?php echo __("Price")?></th>
	    <th><?php echo __("Pendiente")?></th>
	    <th><?php echo __("Date")?></th>
	  </tr>
    </thead>


<?php
$inter=array("odd","even");
foreach($inscriptionCollection as $key=>$Inscription){
	$Course=$Inscription->getPublicationPrice()->getPublication()->getCourse();
	$PublicationPrice=$Inscription->getPublicationPrice();
	
	$TotalPrice=$Inscription->getInvoicePrice();
	$TotalPayments=$Inscription->getTotalPayment();
	$pending=$TotalPrice-$TotalPayments;
	$class=array_shift($inter);
	array_push($inter,$class);
	?>
	<tbody class="row">
	<tr class="show <?php echo $class?>">
		<td><a class="jstoggle icon" href="#totle" data-toggle="insc_<?php echo $Inscription->getId()?>">+</a></td>
		<td><?php echo  $Course->getName(); ?></td>
		<td><?php echo  $PublicationPrice->getDescription(); ?></td>
		<td><?php echo  $TotalPrice; ?></td>
		<td><?php echo  $pending; ?></td>
		<td><?php echo  $Inscription->getCreatedAt(); ?></td>
	</tr>
	<tr class="hide-content">
		<td colspan="6">
			<div style="width: 96%; padding: 5px 2%; display: none" id="insc_<?php echo $Inscription->getId()?>">
				<table style="width: 100%" >
					<thead>
						<tr>
							<td><?php echo __("Description")?></td>
							<td><?php echo __("Expiration Date")?></td>
							<td><?php echo __("Amount")?></td>
							<td><?php echo __("Pendiente")?></td>
							<td><?php echo __("Pagos");?></td>
						</tr>
					</thead>
					<tbody>
						<?php foreach($Inscription->getInvoices() as $key=> $Invoice){ 
						$invoicePrice=$Invoice->getTotalPrice();
						$invoicePayment=$Invoice->getTotalPayments();
						$invoicePending=$invoicePrice-$invoicePayment;
						?>
						<tr>
							<td><?php echo $Invoice->getDescription()?></td>
							<td><?php echo $Invoice->getExpiresAt()?></td>
							<td><?php echo $invoicePrice; ?></td>
							<td><?php echo $invoicePending?></td>
							<td><?php include_partial("renderOptionInvoice", array("Invoice"=>$Invoice))?></td>
						</tr>
						<?php }?>
					</tbody>
				</table>
			</div>
		</td>
	</tr>
	</tbody>
	<?php 
}
?>
</table>

<script type="text/javascript">
	(function($){
		$(".jstoggle").each(function(){
			var $this= $(this);
			var $toggle=$("#"+$this.attr("data-toggle"));
			if($toggle.css("display")=="none"){
				$this.addClass("open");
			}else{
				$this.addClass("collapse");
			}
			$this.click(function(){
				if($this.hasClass("open")){
					$toggle.css("display","block");
					$this.removeClass("open").addClass("collapse");	
				}else{
					$toggle.css("display","none");
					$this.removeClass("collapse").addClass("open");
				}
				return false;
			});
			
		});
	})(jQuery);
</script>